//
//  BaseViewController.m
//  TruckDriver
//
//  Created by Ting Han on 2017/9/25.
//  Copyright © 2017年 Ting Han. All rights reserved.
//

#import "BaseViewController.h"
@interface BaseViewController ()

@property (nonatomic,strong) YDHUD *hud;



@end

@implementation BaseViewController
- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    [MobClick beginLogPageView:NSStringFromClass([self class])];
}
- (void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];
    [MobClick endLogPageView:NSStringFromClass([self class])];
}   
- (void)viewDidLoad {
    [super viewDidLoad];
   
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)configTableHeader{
    MJRefreshNormalHeader *header = [MJRefreshNormalHeader headerWithRefreshingTarget:self refreshingAction:@selector(loadNewData)];
    
    // 设置文字
    [header setTitle:@"下拉刷新" forState:MJRefreshStateIdle];
    [header setTitle:@"释放刷新数据" forState:MJRefreshStatePulling];
    [header setTitle:@"加载中..." forState:MJRefreshStateRefreshing];
    // 设置字体
    header.stateLabel.font = [UIFont systemFontOfSize:15];
    header.lastUpdatedTimeLabel.font = [UIFont systemFontOfSize:14];
    header.automaticallyChangeAlpha = YES;
    // 设置颜色
    header.stateLabel.textColor = [UIColor lightGrayColor];
    //    header.lastUpdatedTimeLabel.textColor = [UIColor blueColor];
    // 隐藏时间
    header.lastUpdatedTimeLabel.hidden = YES;
    // 马上进入刷新状态
    [header beginRefreshing];
    
    // 设置刷新控件
   self.header = header;
}
- (void)configTableFooter{
    MJRefreshAutoNormalFooter *footer = [MJRefreshAutoNormalFooter footerWithRefreshingTarget:self refreshingAction:@selector(loadMoreData)];
    
    // 设置文字
    [footer setTitle:@"点击或拖拽刷新" forState:MJRefreshStateIdle];
    [footer setTitle:@"加载更多..." forState:MJRefreshStateRefreshing];
    [footer setTitle:@"没有更多数据" forState:MJRefreshStateNoMoreData];
    footer.automaticallyChangeAlpha = YES;
    // 设置字体
    footer.stateLabel.font = [UIFont systemFontOfSize:15];
    
    // 设置颜色
    footer.stateLabel.textColor = [UIColor lightGrayColor];
    
    // 设置footer
   self.footer = footer;
}

- (void)loadNewData{
    
}
- (void)loadMoreData{
    
}
- (void)startHud{
    self.hud = [YDHUD juhuaHUD];
    [self.view addSubview:self.hud];
    [self.hud showAnimated:YES];
}
- (void)endHud{
    [self.hud hideAnimated:YES];
}
@end
